package com.heyqing.topic.CountSegments_0434;

/**
 * ClassName:CountSegments
 * Package:com.heyqing.topic.CountSegments_0434
 * Description:
 *
 * @Date:2024/9/29
 * @Author:Heyqing
 */
public class CountSegments {
    public int countSegments(String s) {
        int count = 0;
        String[] split = s.split("\\s+");
        for (String str : split) {
            if (str.matches(".*[a-zA-Z0-9,.]+.*")) count++;
        }
        return count;
    }
}
